package com.auntvt.timo.jpax.core.quick.node;

import com.auntvt.timo.jpax.core.quick.enums.CriteriaType;
import lombok.Data;

import java.util.List;

/**
 * 条件节点
 *
 * @author 小懒虫 <auntvt@163.com>
 * @date 2021/7/31
 */
@Data
public class CriteriaNode {

    /** 条件类型 */
    private CriteriaType type;

    /** 字段名称 */
    private String fieldName;

    /** 节点值 */
    private Object value;

    /** 字段转换类型 */
    private Class<?> asFieldType;

    /** 子节点集合 */
    private List<CriteriaNode> children;

    public CriteriaNode() {
    }

    public CriteriaNode(CriteriaType type) {
        this.type = type;
    }

    public CriteriaNode(CriteriaType type, String fieldName) {
        this.type = type;
        this.fieldName = fieldName;
    }

    public CriteriaNode(CriteriaType type, String fieldName, Object value) {
        this.type = type;
        this.fieldName = fieldName;
        this.value = value;
    }

    public CriteriaNode(CriteriaType type, List<CriteriaNode> children) {
        this.type = type;
        this.children = children;
    }

    public CriteriaNode(CriteriaType type, String fieldName, List<CriteriaNode> children) {
        this.type = type;
        this.fieldName = fieldName;
        this.children = children;
    }
}
